package com.tim.third.demo.easyexcel;

import com.alibaba.excel.EasyExcel;
import com.alibaba.fastjson.JSON;

import java.util.List;

public class EasyExcelRead {

    
    public void read(){
        String path =
                System.getProperty("user.dir")+"\\src\\test\\java\\com\\example\\demo\\arctech\\easyexcel\\test1.xlsx";

        // 异步处理
        EasyExcel.read(path, DemoData.class, new DemoDataListener())
                .sheet()// 切换sheet
                .headRowNumber(1)// 表头行数
                .doRead();

        // 同步返回，性能较低
        List<Object> list = EasyExcel.read(path, DemoData.class, new DemoDataListener())
                .sheet()// 切换sheet
                .headRowNumber(1)// 表头行数
                .doReadSync();
        System.out.println(JSON.toJSONString(list));
    }


}
